<?php
namespace app\common\model\project_model;

use app\common\model\Base;
use think\Model;

class OrderModel extends Model {

    const STATUS_OK = 1; // 支付完成
    const STATUS_NO = 0; // 未支付

    protected $table = 'ph_order';

    public static function statusList() {
        return [
            self::STATUS_OK => '已支付',
            self::STATUS_NO => '未支付',
        ];
    }

    /**
     * 生成订单流水号
     * @param $wechat_id
     * @return string
     */
    public static function generateTradeNo($wechat_id) {
        return $partner_trade_no = 'PAB'.date('YmdHis', time()) .mt_rand(100,999)  . $wechat_id . mt_rand(10, 99);
    }
}